package com.william.modules.william.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.william.modules.test.entity.TestUser;
import com.william.modules.test.service.ITestUserService;
import com.william.modules.william.entity.SysUser;
import com.william.modules.william.mapper.SysUserMapper;
import com.william.modules.william.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    @Autowired
    private ITestUserService testUserService;

    /**
     *
     */
    @Override
    public void synchData() {
        List<SysUser> list = this.list(new QueryWrapper<SysUser>().eq("id", ""));
        List<TestUser> testUserList = JSONArray.parseArray(JSON.toJSONString(list), TestUser.class);
        testUserService.saveOrUpdateBatch(testUserList);
    }
}
